package org.fast.develop.logicflow.core.meta.task;

import lombok.extern.slf4j.Slf4j;
import org.fast.develop.logicflow.core.meta.task.properties.BrmsJavaClassTaskProperties;
import org.fast.develop.logicflow.runtime.task.delegate.DelegateTask;
import org.fast.develop.logicflow.runtime.task.delegate.TaskListener;
import org.fast.develop.logicflow.springboot.Abcd;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author 莫寅
 * @createTime 2022-11-24 21:29
 * @desc：
 */
@Slf4j
public class BrmsTaskListener implements TaskListener {

    @Autowired
    private Abcd abcd;

    @Override
    public void notify(DelegateTask delegateTask) {
        if(delegateTask.getResourceProperties() instanceof BrmsJavaClassTaskProperties){
            BrmsJavaClassTaskProperties brmsJavaClassTaskProperties = (BrmsJavaClassTaskProperties) delegateTask.getResourceProperties();
            log.info("规则ID：{}", brmsJavaClassTaskProperties.getRuleId());
        }
        abcd.test();
        delegateTask.getVariableInstances().put("result", true);


    }
}
